import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../App.vue';
import V1 from '../components/Vue1.vue';
import V2 from '../components/Vue2.vue';
import V3 from '../components/Vue3.vue';
import V4 from '../components/Vue4.vue';

const routes = [
  {
    path: '/',
    name: 'Home',
    component: HomeView,
  },
  {
    path: '/vue1',
    name: 'Vue1',
    component: V1
  },
  {
    path: '/vue2',
    name: 'Vue2',
    component: V2
  },
  {
    path: '/Vue3',
    name: 'Vue3',
    component: V3    
  },
  {
    path: '/Vue4',
    name: 'Vue4',
    component: () => import('../components/Vue4.vue')
    //使用懒加载 () => import()语法，动态导入组件，可以避免打包后文件过大
  }
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
});

export default router;    